package com.example.demo.roadconvert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 测试方法
 *
 * @author ws
 * @since 2023-09-21
 */
public class RoadConvertMain {
    public static void main(String[] args) {
        SumoData sumoData = new SumoData();
        List<RoadInfoVO> road = new ArrayList<>();

        //road数据
        RoadInfoVO roadInfoVO711 = new RoadInfoVO();
        roadInfoVO711.setLen("301");
        roadInfoVO711.setMaxSpeed("60");
        roadInfoVO711.setName("测试路口1");
        ArrayList<String> between = new ArrayList<>();
        between.add("711");
        between.add("711s");
        roadInfoVO711.setBetween(between);

        RoadInfoVO roadInfoVO712 = new RoadInfoVO();
        roadInfoVO712.setLen("301");
        roadInfoVO712.setMaxSpeed("60");
        roadInfoVO712.setName("测试路口1");
        ArrayList<String> between712 = new ArrayList<>();
        between.add("712");
        between.add("711s");
        roadInfoVO712.setBetween(between712);

        road.add(roadInfoVO711);
        road.add(roadInfoVO712);

        //nodeTopology数据

        Map<String, NodeInfo> stringNodeInfoMap = new HashMap<>();
        NodeInfo nodeInfo = new NodeInfo();
        nodeInfo.setE("111");
        nodeInfo.setN("112");
        nodeInfo.setS("113");
        stringNodeInfoMap.put("a", nodeInfo);

        NodeInfo nodeInfo1 = new NodeInfo();
        nodeInfo1.setS("114");
        stringNodeInfoMap.put("b", nodeInfo1);

        sumoData.setNodeTopology(stringNodeInfoMap);
        sumoData.setRoad(road);


        String s = JSON.toJSONString(sumoData);
        System.out.println(s);


    }
}
